import request from '@/utils/request'


const act_dsn_form_stepApi = {
  list: '/act_dsn_form_step/list',
  listAssociatedProcess: '/act_dsn_form_step/listAssociatedProcess',
  findUnpublishedNodeList: 'flow/findUnpublishedNodeList',
  findStepRelation: '/act_dsn_form_step/findStepRelation',
  setpFieldBatchSave: '/act_dsn_form_stepfield/batchSave',
  setpFieldList: '/act_dsn_form_stepfield/list',
  checkAllStatus: '/act_dsn_form_step/checkAllStatus'
}

/**
 * 校验表单所有的流程环境配置是否完成
 * @param {*} parameter
 */
 export function checkAllStatus(formid) {
  return request({
    url: act_dsn_form_stepApi.checkAllStatus,
    method: 'post',
    params: {formid}
  })
}


/**
 * 流程环节字段配置分页列表
 * @param {*} parameter
 */
 export function setpFieldList(pageinfo) {
  return request({
    url: act_dsn_form_stepApi.setpFieldList,
    method: 'post',
    data: pageinfo
  })
}

/**
 * 批量修改或保存流程表单环节配置
 * @param {*} parameter
 */
 export function setpFieldBatchSave(formid, stepid, list) {
  return request({
    url: act_dsn_form_stepApi.setpFieldBatchSave,
    method: 'post',
    params: {
      formid,
      stepid
    },
    data: list
  })
}

/**
 *  查询并与流程模型环节关联
 * @param {*} parameter
 */
export function findStepRelation(formid, modelSouce, processdefinitionid = null) {
  return request({
    url: act_dsn_form_stepApi.findStepRelation,
    method: 'post',
    params: {
      formid,
      modelSouce,
      processdefinitionid
    }
  })
}

/**
 *  查询未发布的流程模型用户节点列表
 * @param {*} parameter
 */
export function findUnpublishedNodeList(modelKey) {
  return request({
    url: act_dsn_form_stepApi.findUnpublishedNodeList,
    method: 'post',
    params: modelKey
  })
}

/**
 * 流程表单环节配置分页列表
 * @param {*} parameter
 */
export function queryAct_dsn_form_stepList(body) {
  return request({
    url: act_dsn_form_stepApi.list,
    method: 'post',
    data: body
  })
}

/**
 * 流程表单环节配置分页列表 (关联流程名称)
 * @param {*} parameter
 */
 export function listAssociatedProcess(body) {
  return request({
    url: act_dsn_form_stepApi.listAssociatedProcess,
    method: 'post',
    data: body
  })
}